<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>接口列表</title>
<script src="${base}/resource/admin/js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="${res}/code-formatter.js" type="text/javascript"></script>
<link href="${res}/code-formatter.css" type="text/css" rel="stylesheet"></link>
<style>
#sendData {
width: 500px; height: 150px;
}

#rawJson {
width:100%; height: 50px;
}
</style>
<script>
function change(){
	$.ajax({
	    url: $('input[name=url]').val()+'.json',
	    type: 'POST',
	    contentType:'application/json; charset=UTF-8',
	    data: $('#sendData').val(),
	    dataType: 'text',
	    processData: false,
	    success: function (data) {
	    	$('#rawJson').val(data);
	    	process($('#rawJson'),$('.canvas'));
	    }
	});
}
</script>
</head>
<body>
<div>
	<fieldset>
		<legend>接口测试</legend>
	  	<p>地址：<input name="url" type="text" style="width:250px;"/>.json</p>
		<p>数据：<textarea id="sendData">{"DeviceID":"","UID":"","keyCode":"","appVersion":"","data":{}}</textarea></p>
		<p><input type="button" value="发送请求" onclick="change()"/></p>
	</fieldset>
	<fieldset>
		<legend>返回报文</legend>
		<textarea id="rawJson"></textarea>
		<p><input type="button" value="格式化" onclick="process($('#rawJson'),$('.canvas'))"/></p>
		<div class="canvas"></div>
	</fieldset>
</div>
</body>
</html>